package com.hdy.web.dao;

import com.hdy.web.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
//这是一个Mybatis的mapper类
@Mapper
@Repository
public interface UserMapper {
    @Select("select username,password from user_t where username=#{userName} and password=#{password};")
    User getUser(@Param("userName") String userName, @Param("password") String password);

    @Insert("insert into user_t (student_no,institute,grade,class,name,username, password) " +
            "values (#{studentNo},#{institute},#{grade},#{clazz},#{name},#{userName},#{password});")
    int insertUser(@Param("studentNo") String studentNo,@Param("institute") String institute,
                           @Param("grade") String grade,@Param("clazz") String clazz,
                           @Param("name") String name,@Param("userName") String userName,
                           @Param("password") String password) throws Exception;
}
